using System.Drawing;
using System.Drawing.Drawing2D;
namespace Lifter.Gui.Monitor.Contain
{
    public class GroupBoxRoundedRect : BaseContainer
    {
        private EnmColorScheme meColorScheme = EnmColorScheme.Green;
        public override EnmColorScheme ColorScheme
        {
            get
            {
                return this.meColorScheme;
            }
            set
            {
                ColorScheme colorScheme = new ColorScheme(value);
                colorScheme.SetColorScheme(this);
                this.meColorScheme = value;
            }
        }
        protected override void DrawBorder(Graphics aoGraphics, Rectangle aoRectangle)
        {
            aoGraphics.SmoothingMode = SmoothingMode.AntiAlias;
            Rectangle rect;
            if (this.Text.Trim() != "")
            {
                rect = new Rectangle(base.BorderRectangle.X + base.BorderWidth + 1, base.BorderRectangle.Y + 12 + base.BorderWidth, base.BorderRectangle.Width - base.BorderWidth * 2, base.BorderRectangle.Height - (12 + base.BorderWidth * 2));
            }
            else
            {
                rect = new Rectangle(base.BorderRectangle.X + base.BorderWidth + 1, base.BorderRectangle.Y + base.BorderWidth + 1, base.BorderRectangle.Width - base.BorderWidth * 2, base.BorderRectangle.Height - base.BorderWidth * 2);
            }
            for (int i = 1; i >= 0; i--)
            {
                SolidBrush brush = new SolidBrush(Color.FromArgb(127 * (2 - i), base.ShadowColor));
                Pen pen = new Pen(brush);
                aoGraphics.DrawLine(pen, rect.X, rect.Y, rect.X, rect.Bottom);
                aoGraphics.DrawLine(pen, rect.X, rect.Y, rect.Right, rect.Y);
                rect.X++;
                rect.Y++;
                rect.Width -= 2;
                rect.Height -= 2;
            }
            if (rect.Width <= 0)
            {
                rect.Width = 2;
            }
            if (rect.Height <= 0)
            {
                rect.Height = 2;
            }
            aoGraphics.FillRectangle(new LinearGradientBrush(rect, ((IGradientBackgroundColor)this).BackgroundTopColor, ((IGradientBackgroundColor)this).BackgroundBottomColor, LinearGradientMode.Vertical)
            {
                Blend = new Blend
                {
                    Factors = this.IARR_RELATIVEINTENSITIES,
                    Positions = this.IARR_RELATIVEPOSITIONS
                }
            }, rect);
        }
    }
}
